<?php
include 'dbconfig.php'; 

mysql_select_db($db, $con);

$cid = $_POST['cid'];

$query = "SELECT * FROM course_templates WHERE course_templates.cid = '$cid' LIMIT 1";
$result = mysql_query($query);
$row = mysql_fetch_array($result);

echo $row['name']."|$cid|".$row['area1']."|".$row['area2']."|".$row['comp']."|".$row['ects']."|".$row['external']."|".$row['sem']."@";

$query = "SELECT * FROM course_instances WHERE course_instances.cid = '$cid' ORDER BY year desc";

$result = mysql_query($query);

while ($row = mysql_fetch_array($result)) {
	echo $row['hash']."|".$row['year']."|".$row['term']."|".$row['coursekey']."|".$row['teacher']."@";
}


mysql_close($con);
?>